module.exports = options => {
  return async (ctx, next) => {
    try {
      const modeName = require("inflection").titleize(ctx.params.resource);
      ctx.mongoose = require(`../model/admin/${modeName}`);
      await next()
    } catch (error) {
      console.log(error)
      ctx.body = {
        status: 0,
        message: error.message
      }
    }
  }
}